﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace VendingMachine
{
    public class MoneyBox
    {
        public decimal Totalvalue { get; private set; }
        public Dictionary<CoinDenominations, decimal> Coins { get; private set; }

        public MoneyBox()
        {
            Coins = new Dictionary<CoinDenominations, decimal>();
        }

        public decimal GetTotalValue()
        {
            decimal pence;
            decimal pounds;
            decimal total;

            pence = Coins[CoinDenominations.OnePence] +
                    Coins[CoinDenominations.FivePence] * 5 +
                    Coins[CoinDenominations.TenPence] * 10 +
                    Coins[CoinDenominations.TwentyPence] * 20 +
                    Coins[CoinDenominations.FiftyPence] * 50;

            pounds = Coins[CoinDenominations.OnePound] + Coins[CoinDenominations.TwoPound] * 2;
            total = pounds + (pence / 100);

            return total;
        }

    }

}
